//
//  SignsViewController.m
//  Nurse
//
//  Created by 张攀 on 13-12-23.
//  Copyright (c) 2013年 RainSets. All rights reserved.
//

#import "SignsViewController.h"

#import "SignsViewCell.h"
#import "PatientInfoView.h"
#import "AddSignsViewController.h"
#import "PatientService.h"
@interface SignsViewController ()

@end

@implementation SignsViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title  = @"体征";
    [self setleftBarButtonItem:@""orImaged:@"head-icon_04.png" Event:@selector(leftBar_clicked:)];
    
    [self setrightBarButtonItem:@""orImaged:@"head-icon_03.png" Event:@selector(rightBar_clicked:)];
    
    
    [self.entryBtn setTitle:@"录入" forState:UIControlStateNormal];
    [self.entryBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.entryBtn setBackgroundImage:[UIImage imageNamed:@"head-bg.png"] forState:UIControlStateNormal];
    
   // NSArray *ibs = [[NSBundle mainBundle] loadNibNamed:@"PatientInfoView" owner:nil options:nil];
//    // TestView *test = [ibs objectAtIndex:0];
   // PatientInfoView *pInfoView = (PatientInfoView *)[ibs objectAtIndex:0];

    //#import "PatientService.h"
NSDictionary* patient = [[PatientService sharedInstance]currentPatient];
 
 self.pInfoView.txtPatientName.text = [patient valueForKey:@"姓名"];
 self.pInfoView.txtPatientID.text = [NSString stringWithFormat:@"住院号:%@",[patient valueForKey:@"住院号"]];
 self.pInfoView.txtBedNo.text = [NSString stringWithFormat:@"床位号:%@",[patient valueForKey:@"床位号"]];
   //[self.view addSubview:pInfoView];
    NSString*xb= [patient valueForKey:@"性别"];
    if ([xb isEqualToString:@"女"]) {
        self.pInfoView.imgxb.image=[UIImage imageNamed:@"gender-female2.png"];
        
    }
    else{
        self.pInfoView.imgxb.image=[UIImage imageNamed:@"gender-male2.png"];
    }
    
}





#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 5;
}
- (float)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *CellIdentifier = @"SignsViewCell";
    
    SignsViewCell *cell = (SignsViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if(cell==nil){
        
        NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SignsViewCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
        
        
    }
    
    switch (indexPath.row) {
        case 0:
        {
            cell.nameLabel.text=@"体温";
        }
            break;
        case 1:
        {
            cell.nameLabel.text=@"脉搏";
        }
            break;
        case 2:
        {
            cell.nameLabel.text=@"心率";
        }
            break;
        case 3:
        {
            cell.nameLabel.text=@"呼吸";
        }
            break;
        case 4:
        {
            cell.nameLabel.text=@"血压";
        }
            break;
            
            
        default:
        {
            
        }
            break;
    }
    
    
    
    
    cell.selectionStyle=UITableViewCellSelectionStyleNone;
    return cell;
    
}




-(IBAction) entryBtn_click:(id)sender{
    
    AddSignsViewController *vc = [[AddSignsViewController alloc]init];
    self.navigationController.hidesBottomBarWhenPushed = YES;
    vc.hidesBottomBarWhenPushed = YES;
    [App hideTabbar];
    [self.navigationController pushViewController:vc animated:YES];
    
    
}



-(void)leftBar_clicked:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
    
}

-(void)rightBar_clicked:(id)sender{
    
    AddSignsViewController *vc = [[AddSignsViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
    
    
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
